<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <title>兴趣选择</title>

    <!-- Expand styles -->
    <link href="../css/app/app.css" rel="stylesheet">
    <link href="../css/app/default.css" rel="stylesheet">
    <link href="../css/mui/mui.css" rel="stylesheet">
</head>

<body>
    <div class="price-list">
        <!-- header -->
        <div class="mobile-content5 margin-b-60">
            <div class="widget-body widget-default">
                <p class="text-center black font-18 no-margin padding-t-20">选择你感兴趣的视频吧</p>
                <p class="text-center font-12 gray no-margin">至少选择一个<span class="padding-l-5">可随时调整</span></p>
                <div id="videoTypeDiv">

                </div>
            </div>

        </div>
    </div>
    <div class="hobby-maskbg"></div>
    <div class="hobby-footer">
        <div class="bot">
            <span style="display: block;" class="white font-14 text-center" onclick="selectHobbiesSure()">选好了 进入视频页</span>
            <img src="../img/new-expert/go-right.png" alt="">
        </div>

    </div>
    </div>

    <script src="../js/dsbridge.js"></script>
    <script src="../js/jquery.js"></script>
    <script src="../js/mui/mui.js"></script>
    <script src="../js/mui/mui.picker.min.js"></script>
    <script src="../js/layer.js"></script>
    <script src="../js/app/app-base.js"></script>
    <script src="../js/app/app-url.js"></script>
    <script src="../js/app/app-ajax.js"></script>
    <script>
       
        $(document).ready(function(){
            //获取视频分类
            getVideoType();
        })

        //获取视频分类
        function getVideoType(){
            var data = {
            }
            getServerData(url_agrivideoInfo_getVideoType, data);
        }

         //选择三级类型
         mui("#videoTypeDiv").on('tap','.thirdType',function(){
            $(this).toggleClass("tuli-bg");
        });

        //选好了
        function selectHobbiesSure(){
            var thirdTypeCodeList = new Array();
            $("#videoTypeDiv .thirdType").each(function(index,item){
                thirdTypeCodeList.push($(item).attr("code"));
            })
            if(thirdTypeCodeList.length <= 0){
                showToast("至少选择一个兴趣类型");
                return false;
            }
            var data = {
                userAccId:getUserId(),
                thirdTypeCodeList:thirdTypeCodeList
            }
            getServerData(url_agrivideoInfo_saveUserVideoHobby, data);
        }

        function getServerDataSuccess(url, data) {
            switch(url){
                case url_agrivideoInfo_getVideoType:
                    var firstTypeList = data.data;
                    var h5 = '';
                    if(firstTypeList != null && firstTypeList.length > 0){
                        $.each(firstTypeList,function (index,item){
                            var secondTypeList = item.children;
                            if(secondTypeList != null && secondTypeList.length > 0){
                                $.each(secondTypeList,function(sIndex,sItem){
                                    h5+= '<div class="padding-t-20 display-flex align-items-center"><span class="tuli"></span><span class="padding-l-5 font-weight black font-13">'+sItem.name+'</span></div>'
                                        +'<div class="padding-t-10 display-flex flex-warp padding-b-15 border1">';
                                    var thirdTypeList = sItem.children;
                                    if(thirdTypeList != null && thirdTypeList.length > 0){
                                        $.each(thirdTypeList,function(tIndex,tItem){
                                            h5+= '<span class="tuli-content font-15 thirdType" code="'+tItem.code+'">'+tItem.name+'</span>';
                                        })
                                    }
                                    h5+='</div>';
                                })
                            }
                        })
                    }
                    $("#videoTypeDiv").html(h5);
                    break;
                case url_agrivideoInfo_saveUserVideoHobby:
                    dsBridge.call("goVideoList","");
                    break;
            }
        }

       
    </script>

</body>

</html>